From d490d8f1f32f4b89ce59973034f0557c6074feb4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timm=20B=C3=A4der?= Date: Wed, 18 Dec 2019 11:43:26 +0100 Subject: [PATCH] renderbackground: Try to omit a save/restore pair --- gtk/gtkrenderbackground.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/gtk/gtkrenderbackground.c b/gtk/gtkrenderbackground.c index ed85535529..b241a7e615 100644 --- a/gtk/gtkrenderbackground.c +++ b/gtk/gtkrenderbackground.c @@ -150,12 +150,17 @@ gtk_theming_background_snapshot_layer (GtkCssBoxes *bg, if (hrepeat == GTK_CSS_REPEAT_STYLE_NO_REPEAT && vrepeat == GTK_CSS_REPEAT_STYLE_NO_REPEAT) { /* shortcut for normal case */ - gtk_snapshot_save (snapshot); - gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y)); - - gtk_css_image_snapshot (image, snapshot, image_width, image_height); - - gtk_snapshot_restore (snapshot); + if (x != 0 || y != 0) + { + gtk_snapshot_save (snapshot); + gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y)); + gtk_css_image_snapshot (image, snapshot, image_width, image_height); + gtk_snapshot_restore (snapshot); + } + else + { + gtk_css_image_snapshot (image, snapshot, image_width, image_height); + } } else { -- 2.30.2